﻿CREATE TABLE [invoicing2014].[BookOrders] (
    [ID]             INT           IDENTITY (1, 1) NOT NULL,
    [OrderNo]        VARCHAR (255) NOT NULL,
    [CustomerID]     INT           NOT NULL,
    [NoteDate]       DATETIME      CONSTRAINT [DF_BookOrders_NoteDate] DEFAULT (getdate()) NOT NULL,
    [OperatorUserID] INT           NOT NULL,
    [CreatedOn]      DATETIME      CONSTRAINT [DF_BookOrders_CreatedOn] DEFAULT (getdate()) NOT NULL,
    [Method]         INT           NOT NULL,
    [OrderStatus]    INT           NOT NULL,
    CONSTRAINT [PK_BookOrders] PRIMARY KEY CLUSTERED ([ID] ASC),
    CONSTRAINT [FK_BookOrders_Customers] FOREIGN KEY ([CustomerID]) REFERENCES [dbo].[Customers] ([ID]),
    CONSTRAINT [FK_BookOrders_Users] FOREIGN KEY ([OperatorUserID]) REFERENCES [dbo].[Users] ([ID])
);

